import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)

const routes = [{
        path: '/',
        name: 'home',
        component: () =>
            import ('../views/HomeView.vue'),

        children: [{
                path: 'index',
                name: 'index',
                component: () =>
                    import ('../views/IndexView.vue'),
                children: [{
                    path: ':type/:id:index',
                    name: "indexitem",
                    props: true,
                    component: () =>
                        import ('../components/IndexView/IndexItemView.vue')
                }]
            },
            {
                path: 'sort',
                name: 'sort',
                component: () =>
                    import ('../views/SortView.vue')
            },
            {
                path: 'circles',
                name: 'circles',
                component: () =>
                    import ('../views/CirclesView.vue')
            },
            {
                path: 'cart',
                name: 'cart',
                component: () =>
                    import ('../views/CartView.vue')
            },
            {
                path: 'mine',
                name: 'mine',
                component: () =>
                    import ('../views/MineView.vue')
            }

        ],
    },
    {
        path: '/search',
        name: 'search',
        component: () =>
            import ('../views/SearchView.vue')

    },
    {
        path: '/login',
        name: 'login',
        component: () =>
            import ('../views/LoginView.vue')

    },
    {
        path: '/account',
        name: 'account',
        props: true,
        component: () =>
            import ('../components/Mine/ConfirmAccount.vue')
    }, {
        path: '/loginaccount',
        name: 'loginaccount',
        props: true,
        component: () =>
            import ('../components/Mine/LoginAccount.vue')
    },
    {
        path: '/productdetails/:id',
        name: '/productdetails/:id',
        component: () =>
            import ('../views/ProductDetailsView.vue')
    },
    {
        path: '/settlement/:id',
        name: 'settlement',
        props: true,
        component: () =>
            import ('../views/SettlementView.vue')
    },
    {
        path: '/address',
        name: 'address',
        component: () =>
            import ('../views/AddressView.vue')
    },
    {
        path: '/addaddress',
        name: 'addaddress',
        component: () =>
            import ('../views/AddressdetailView.vue')
    },
    {
        path: '/order',
        name: 'order',
        component: () =>
            import ('../views/OrderView.vue')
    },
    {
        path:'/Comment/:id',
        component:() =>
            import('../views/CommentView.vue')
    },
]

const router = new VueRouter({
    mode: 'history',
    base: process.env.BASE_URL,
    routes
})

export default router